<?php

namespace app\admin\model\game;

use think\Model;


class Dota2 extends Model
{

    

    // 表名
    protected $name = 'game_dota2';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'num_text',
        'line_text',
        'attr_text',
        'type_text'
    ];

    
    public function getNumList()
    {
        return ['single' => __('Single'), 'double' => __('Double')];
    }     

    public function getLineList()
    {
        return ['tianhui' => __('Tianhui'), 'yingyan' => __('Yingyan'), 'yemo' => __('Yemo')];
    }     

    public function getAttrList()
    {
        return ['power' => __('Power'), 'agile' => __('Agile'), 'intellect' => __('Intellect')];
    }     

    public function getTypeList()
    {
        return ['close' => __('Close'), 'far' => __('Far')];
    }


    public function getAttrTextAttr($value,$data)
    {
        switch ( $data['attr'] ){
            case 'power':
                return '力量';
                break;
            case 'agile':
                return '敏捷';
                break;
            case 'intellect':
                return '智慧';
                break;
        }
    }
    public function getLineTextAttr($value,$data)
    {
        switch ( $data['line'] ){
            case 'tianhui':
                return '天辉';
                break;
            case 'yemo':
                return '夜魔';
                break;
        }
    }

    public function getNumTextAttr($value,$data)
    {
        switch ( $data['num'] ){
            case 'double':
                return '双';
                break;
            case 'single':
                return '单';
                break;
        }
    }
    public function getTypeTextAttr($value,$data)
    {
        switch ( $data['type'] ){
            case 'close':
                return '近战';
                break;
            case 'far':
                return '远程';
                break;
        }
    }




}
